//
//  EasyTabBarViewController.m
//  TestDemo
//
//  Created by 张润东 on 2021/8/24.
//

#import "EasyTabBarViewController.h"
@interface EasyTabBarViewController ()

@end

@implementation EasyTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self customTabBar];
}

-(void)viewWillLayoutSubviews{
   [super viewWillLayoutSubviews];
   // 移除系统TabBar的UITabBarItem
   for (UIView *view in self.tabBar.subviews) {
       if (![view isKindOfClass:[EasyTabBar class]]) {
           [view removeFromSuperview];
       }
   }
}

-(void)viewDidLayoutSubviews{
   [super viewDidLayoutSubviews];
   // 移除系统TabBar的UITabBarItem
   for (UIView *view in self.tabBar.subviews) {
       if (![view isKindOfClass:[EasyTabBar class]]) {
           [view removeFromSuperview];
       }
   }
}

/// 自定义tabbar
- (void)customTabBar{
   // tabbar图标名称
//   NSArray *sbNames = @[
//                        @"tabbar_01",
//                        @"tabbar_02",
//                        @"tabbar_03",
//                        @"tabbar_04",
//                        @"tabbar_05"
//                        ];
//   //2 设置自定义tabBar
//   EasyTabBar *tabBar = [EasyTabBar tabBarWithImgNames:sbNames special:YES specialIndex:4];
//   //设置代理
//   tabBar.delegate = self;
//   // 加到系统tabbar位置
//   [self.tabBar addSubview:tabBar];
//   tabBar.frame = self.tabBar.bounds;
}

-(void)tabBarDidSelectIndex:(NSInteger)selectIndex disIndex:(NSInteger)disIndex selectBtn:(UIButton *)selBtn disBtn:(UIButton *)disBtn{
//    self.selectedIndex = selectIndex;
//    NSLog(@"selectIndex%ld--disIndex%ld--selBtn%ld--disBtn%ld",selectIndex,disIndex,selBtn.tag,disBtn.tag);
//
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
